const router = require('koa-router')();
const urlencode = require('urlencode');


router.get('/',async(ctx,next)=>{
    await ctx.render('ceshi',{
        title:'测试'
    })
})

router.get('/index',async(ctx,next)=>{
    const path = urlencode('http://wx.51zixuewang.cn')
    const url = `https://open.weixin.qq.com/connect/oauth2/authorize?appid=wxbeaeb1c48efb385c&redirect_uri=${path}&response_type=code&scope=snsapi_userinfo&state=123#wechat_redirect`
    
    ctx.response.redirect(url)

    // await ctx.render('index',{
    //     title:'测试',
    //     url:url
    // })
})

module.exports = router